package com.flyee.utils
{
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.Shape;
	import flash.display.Sprite;
	
	public class CreateHot
	{
		public function CreateHot()
		{
		}
		/**
		 * 
		 * @param souce 要求Souce中的负坐标区域中不能有图像
		 * @return 
		 * 
		 */		
		public static function create(souce:DisplayObject):Sprite
		{
			var tempBitmapData:BitmapData = new BitmapData(souce.width,souce.height,true,0);
			tempBitmapData.draw(souce);
			
			var tempShape:Sprite = new Sprite();
			var tempLength:uint = Math.round(souce.width+0.5);
			var tempLength2:uint = Math.round(souce.height+0.5);
			for(var i:int = 0; i < tempLength; i++)
			{
				for(var j:int = 0; j < tempLength2; j++)
				{
					var tempColor:uint = tempBitmapData.getPixel32(i,j);
					var alphaValue:uint = tempColor >> 24 & 0xFF;
					if(alphaValue != 0)
					{
						tempShape.graphics.beginFill(tempColor);
						tempShape.graphics.drawCircle(i,j,1);
						tempShape.graphics.endFill();
					}
				}
			}
			return tempShape;
		}
	}
}